package cn.chenhongchao.zhaobiaopingtai.controller;

import cn.chenhongchao.zhaobiaopingtai.common.api.CommonPage;
import cn.chenhongchao.zhaobiaopingtai.common.api.CommonResult;
import cn.chenhongchao.zhaobiaopingtai.dto.ReturnBidDTO;
import cn.chenhongchao.zhaobiaopingtai.entity.ReturnBid;
import cn.chenhongchao.zhaobiaopingtai.service.impl.BidServiceImpl;
import cn.chenhongchao.zhaobiaopingtai.service.impl.ReturnBidServiceImpl;
import cn.chenhongchao.zhaobiaopingtai.service.impl.TenderServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/tenderReturn")
@Api(value = "tenderReturn", tags = "tenderReturn")
@CrossOrigin
public class TenderReturnController {

    @Autowired
    private BidServiceImpl bidService;

    @PostMapping("getTenderReturn")
    public CommonResult getTenderReturn(@RequestParam(value = "page", required = false) Integer pageNum,
                                        @RequestParam(value = "size", required = false) Integer pageSize,
                                        @RequestBody ReturnBidDTO returnBidDTO) {

        if (pageNum == null) {
            pageNum = 1;
        }

        if (pageSize == null) {
            pageSize = 10;
        }

        CommonPage<ReturnBid> returnBidCommonPage = bidService.dynamicQuery(pageNum, pageSize, returnBidDTO);
        return CommonResult.success(returnBidCommonPage);


    }

}
